﻿using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using Budget.Core.Exceptions;

namespace Budget.Core.DomainModel
{
    public class Product : BaseEntity
    {
        public virtual String Name { get; set; }

        public virtual Category Category { get; protected set; }

        public virtual ICollection<OutcomeOrder> OutcomeOrders { get; protected set; }

        protected Product()
        {
            OutcomeOrders = new Collection<OutcomeOrder>();
        }

        public Product(Category category)
            : this()
        {
            Check.Require<ArgumentNullException>(category != null, "category");

            category.Products.Add(this);
            Category = category;
        }
    }
}
